﻿#region Copyright information
// 
// Copyright © 2005-2013 Yongkee Cho. All rights reserved.
// 
// This code is a part of the Biological Object Library and governed under the terms of the
// GNU Lesser General  Public License (LGPL) version 2.1 which accompanies this distribution.
// For more information on the LGPL, please visit http://bol.codeplex.com/license.
// 
// - Filename: EntrySet.cs
// - Author: Yongkee Cho
// - Email: yongkeecho@gmail.com
// - Date Created: 2013-01-25 3:25 PM
// - Last Modified: 2013-01-25 3:59 PM
// 
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

namespace BOL.Models.MolecularInteractions
{
    [DataContract]
    //[XmlRoot(ElementName="entrySet", Namespace=EntrysetNamespace)] 
    public sealed class EntrySet
    {
        #region Private variables

        private const string EntrysetNamespace = "net:sf:psidev:mi";
        //private const string XsiNamespace = "http://www.w3.org/2001/XMLSchema-instance"; 

        #endregion

        #region Public properties

        //[XmlNamespaceDeclarations]
        //public XmlSerializerNamespaces Namespaces = new XmlSerializerNamespaces(
        //        new[] 
        //        { 
        //            new XmlQualifiedName("xsi", XsiNamespace), 
        //            new XmlQualifiedName(String.Empty, EntrysetNamespace) 
        //        });

        //[XmlAttribute(AttributeName = "schemaLocation", Namespace = XsiNamespace)]
        public string SchemaLocation = String.Format("{0} http://psidev.sourceforge.net/mi/rel25/src/MIF253.xsd", EntrysetNamespace);

        //[XmlElement("entry")]
        public IEnumerable<Entry> Entries { get; private set; }

        //[XmlAttribute("level")]
        public int Level { get; private set; }

        //[XmlAttribute("version")]
        public int Version { get; private set; }

        //[XmlAttribute("minorVersion")]
        public int MinorVersion { get; private set; }

        #endregion

        #region Constructors

        public EntrySet(IEnumerable<Entry> entries, int level, int version, int minorVersion)
        {
            if (entries == null)
                throw new ArgumentNullException("entries");

            Entries = entries;
            Level = level;
            Version = version;
            MinorVersion = minorVersion;
        }

        #endregion

        #region Object overriden

        public override string ToString()
        {
            return String.Format("EntrySet{{entries='{0}', level='{1}', version='{2}', minorVersion='{3}'}}", Entries.Count(), Level, Version, MinorVersion);
        }

        #endregion
    }
}
